import { Global } from "../../../../../com/gengine/global/Global";
import { LayerManager } from "../../../manager/LayerManager";
import { DisplayUtil } from "../../../../common/DisplayUtil";
import { Dispatcher } from "../../../../mvc/core/Dispatcher";
import { DataEvent } from "../../../events/DataEvent";
import { EventName } from "../../../mvc/EventName";
import { SWFPlayer } from "../../../scene/modle/SWFPlayer";
import { ObjCreate } from "../../common/ObjCreate";
import { Language } from "../../../../../extend/language/Language";
import { ObjectPool } from "../../../../../com/gengine/utils/pools/ObjectPool";
import { ModelType } from "../../../scene/modle/data/ModelType";
import { GButton } from "../../../../../com/mui/controls/GButton";
type int = number;
//class Lv70OpShowShopEntrace
    
    export  class Lv70OpShowShopEntrace /* flash.display.Sprite */
    {
        constructor()
        {
            
            this.initView();
            this._btnOpenShop.addEventListener(flash.events.MouseEvent.CLICK, this.clickOpenShopHandler);
            this._btnLeave.addEventListener(flash.events.MouseEvent.CLICK, this.clickLeaveHandler);
            return;
        }

        public dispose(): void
        {
            if (this._bg != null) 
            {
                this._bg.dispose();
                this._bg = null;
            }
            return;
        }

        public middlePlace(): void
        {
            this.x = (Global.stage.stageWidth - 420) / 2;
            this.y = (Global.stage.stageHeight - 220) / 2;
            return;
        }

        public get step(): int
        {
            return this._step;
        }

        public set step(arg1: int)
        {
            this._step = arg1;
            return;
        }

        public show(arg1: Function=null): void
        {
            this.reLoadBg();
            this.x = (Global.stage.stageWidth - 420) / 2;
            this.y = (Global.stage.stageHeight - 220) / 2;
            LayerManager.windowLayer.addChild(this);
            if (this._callback != null) 
            {
                this._callback.apply();
            }
            return;
        }

        public hide(): void
        {
            DisplayUtil.removeMe(this);
            return;
        }

        public isHide(): Boolean
        {
            return this.parent == null;
        }

        /* internal  */clickOpenShopHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.OpenDramaLotteryModule));
            return;
        }

        /* internal  */clickLeaveHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.CopyQuitCopy));
            Dispatcher.dispatchEvent(new DataEvent(EventName.CloseDramaLotteryModule));
            return;
        }

        /* internal  */loadSWFCompleted(arg1: SWFPlayer): void
        {
            if (arg1.movieClipData != null) 
            {
                arg1.movieClipData.isClear(false);
            }
            return;
        }

        /* internal  */initView(): void
        {
            this._btnOpenShop = ObjCreate.createGButton("", 130, 167, 77, 28, this, "ButtonRed");
            this._btnOpenShop.label = Language.getString(53002);
            this._btnLeave = ObjCreate.createGButton("", 230, 167, 77, 28, this, "ButtonRed");
            this._btnLeave.label = Language.getString(60018);
            return;
        }

        /* internal  */reLoadBg(): void
        {
            if (this._bg == null) 
            {
                this._bg = ObjectPool.getObject(SWFPlayer);
                this._bg.move(215, 215);
                this._bg.loadComplete = this.loadSWFCompleted;
                this._bg.load("Lv70DramaShopEntrance.swf", ModelType.NormalSwf, null);
                this.addChildAt(this._bg, 0);
            }
            return;
        }

        /* internal */ /* var */_btnOpenShop: GButton;

        /* internal */ /* var */_btnLeave: GButton;

        /* internal */ /* var */_callback: Function;

        /* internal */ /* var */_step: int;

        /* internal */ /* var */_bg: SWFPlayer;
    }
